﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using System.Data;

public partial class companypart_CompanyMastermaster : System.Web.UI.MasterPage
{
    public string Banner
    {
        get
        {
            if (Session["banner"] != null)
            {
                return Session["banner"].ToString();
            }
            else
            {
                string s = "../images/dawrya baner.swf";
                DataSet ds = DB.getdata("Select * from companysetting where company_id = "+ Session["company_id"].ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Session["banner"] = "../uploads/" + ds.Tables[0].Rows[0]["banner"].ToString();
                    return Session["banner"].ToString();
                }
                else
                {
                    Session["banner"] = s;
                    return s;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if ((Session["role_id"] != null) && (int.Parse(Session["role_id"].ToString()) != 2))
            {
                Response.Redirect("~/Default.aspx");

            }
            else
            {
                logout.Visible = true;
                users.Text = Session["user"].ToString().Split(',')[0];

            }

        }
        if (Session["user"] != null)
        {
            lk1.NavigateUrl = Session["url"].ToString();
           
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if ((Session["role_id"]== null) || (int.Parse(Session["role_id"].ToString()) != 2))
            {
                Response.Redirect("~/Default.aspx");

            }
            else
            {
                logout.Visible = true;
                users.Text = Session["user"].ToString().Split(',')[0];

            }

        }

    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-SA");
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ar-SA");
        Session["CurrentCulture"] = "ar-SA";
        Server.Transfer(Request.Path);
    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
        Session["CurrentCulture"] = "en-US";
        Server.Transfer(Request.Path);
    }
    protected void LinkButton8_Click(object sender, EventArgs e)
    {
        string obj = Session["CurrentCulture"].ToString();

        Session.Clear();
        Session["CurrentCulture"] = obj;
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(obj);
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(obj);
        Response.Redirect("~/Default.aspx");
    }
}
